package com.yan.demo04;

import com.yan.demo02.UserService;
import com.yan.demo02.UserServiceImpl;

public class Client {
    public static void main(String[] args) {
        //真实角色
        UserServiceImpl userService = new UserServiceImpl();
        //代理角色
        ProxyInvactionHandle handle = new ProxyInvactionHandle();

        handle.setTarget(userService);//设置要代理的对象
        //动态生成代理类
        UserService proxy = (UserService) handle.getProxy();

        proxy.add();

    }
}
